Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separating content type and text encoding when constructing cached response #13

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mj
Copy link
Contributor

@mj mj commented Feb 26, 2012

While using AFCache I noticed that apparently UIWebView gets confused when the text encoding is part of the MIME type (aka content type) field of a NSURLResponse. This can happen when the original request was responded by a web application with e.g. the perfectly legal header Content-type: text/html; charset=utf-8.

I fixed this by implementing a simple parser for MIME types per RFC 2616 (see section 3.7) and using that one to split the content type and the text encoding.

Please let me know if you like the patch. If further works needs to be done to get this into your branch, I'd be happy to do that.

… header

is part of the MIMEType property of a NSURLResponse. Splitting the MIME type
and passing the conding using textEncodingName fixes this.

We probably need to figure out a more solid way to parse the MIME type.
These changes should have been part of the previous commit but
somehow got lost somewhere.
@kteman
Copy link

kteman commented Jul 17, 2012

This should be added. It worked great to eliminate the problem of UIWebview showing HTML code instead of the actual webpage due to mime types not being recognized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants